<?php

defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.application.component.controller' );

class EcommerceControllerOrders extends JController
{
	function __construct( $default = array())
	{
		parent::__construct( $default );
		JHTML::_('behavior.modal', 'a.modal');
	}

	function display() 
	{
	  parent::display();
	}
  
  	function remove()
	{
		$model = $this->getModel('orders');
		if(!$model->delete()) {
			$msg = JText::_( 'Error, cannot deleted' );
		} else {
			$msg = JText::_( 'Orders Deleted!' );
		}
		$this->setRedirect( 'index.php?option=com_ecommerce&controller=orders', $msg );
	}
	
	function paid() {
		$model = $this->getModel('orders');
		$model->setPaid(1);
		$msg = "Order status is changed";
		$this->setRedirect( 'index.php?option=com_ecommerce&controller=orders', $msg );
	}
	
	function unPaid() {
		$model = $this->getModel('orders');
		$model->setPaid(0);
		$msg = "Order status is changed";
		$this->setRedirect( 'index.php?option=com_ecommerce&controller=orders', $msg );
	}
}
?>
